shutter 2.2.1
Loading...
Searching...
No Matches
shutter


Shutter Click

Shutter Click demo application is developed using the NECTO Studio, ensuring compatibility with mikroSDK's open-source libraries and tools. Designed for plug-and-play implementation and testing, the demo is fully compatible with all development, starter, and mikromedia boards featuring a mikroBUS™ socket.


Click Library

  • Author : Stefan Filipovic
  • Date : Dec 2022.
  • Type : GPIO type

Software Support

Example Description

This example demonstrates the use of Shutter Click board by taking pictures with and without auto focus function.

Example Libraries

  • MikroSDK.Board
  • MikroSDK.Log
  • Click.Shutter

Example Key Functions

  • shutter_cfg_setup Config Object Initialization function.
    void shutter_cfg_setup(shutter_cfg_t *cfg)
    Shutter configuration object setup function.
    Shutter Click configuration object.
    Definition shutter.h:114
  • shutter_init Initialization function.
    err_t shutter_init ( shutter_t *ctx, shutter_cfg_t *cfg );
    err_t shutter_init(shutter_t *ctx, shutter_cfg_t *cfg)
    Shutter initialization function.
    Shutter Click context object.
    Definition shutter.h:103
  • shutter_set_auto_focus This function sets the auto focus ON/OFF by setting the AF pin to desired logic state.
    void shutter_set_auto_focus ( shutter_t *ctx, uint8_t state );
    void shutter_set_auto_focus(shutter_t *ctx, uint8_t state)
    Shutter set auto focus function.
  • shutter_set_shutter This function sets the shutter ON/OFF by setting the SHT pin to desired logic state.
    void shutter_set_shutter ( shutter_t *ctx, uint8_t state );
    void shutter_set_shutter(shutter_t *ctx, uint8_t state)
    Shutter set shutter function.
  • shutter_take_picture This function sets AF and SHT pins to desired states for taking pictures with or without auto focus function.
    void shutter_take_picture ( shutter_t *ctx, uint8_t auto_focus );
    void shutter_take_picture(shutter_t *ctx, uint8_t auto_focus)
    Shutter take picture function.

Application Init

Initializes the driver and logger.

void application_init ( void )
{
log_cfg_t log_cfg;
shutter_cfg_t shutter_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
// Click initialization.
shutter_cfg_setup( &shutter_cfg );
if ( DIGITAL_OUT_UNSUPPORTED_PIN == shutter_init( &shutter, &shutter_cfg ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
log_info( &logger, " Application Task " );
}
#define SHUTTER_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition shutter.h:91
void application_init(void)
Definition main.c:34
#define MIKROBUS_POSITION_SHUTTER
Definition main.c:28

Application Task

Swithes ON the auto focus function and triggers the shutter to take the picture, then swithes OFF the auto focus and triggers the shutter. The shutter is triggered every 13 seconds approximately. All data is being logged on the USB UART where you can track the program flow.

void application_task ( void )
{
log_printf( &logger, " Take picture with auto focus\r\n\n" );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
log_printf( &logger, " Take picture without auto focus\r\n\n" );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
}
#define SHUTTER_STATE_OFF
Shutter state setting.
Definition shutter.h:72
#define SHUTTER_STATE_ON
Definition shutter.h:73
void application_task(void)
Definition main.c:64

Application Output

This Click board can be interfaced and monitored in two ways:

  • Application Output - Use the "Application Output" window in Debug mode for real-time data monitoring. Set it up properly by following this tutorial.
  • UART Terminal - Monitor data via the UART Terminal using a USB to UART converter. For detailed instructions, check out this tutorial.

Additional Notes and Information

The complete application code and a ready-to-use project are available through the NECTO Studio Package Manager for direct installation in the NECTO Studio. The application code can also be found on the MIKROE GitHub account.